package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.StrichenDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity Strichen and its DTO StrichenDTO.
 */
@Mapper(componentModel = "spring", uses = {ProductMapper.class, })
public interface StrichenMapper extends EntityMapper <StrichenDTO, Strichen> {

    @Mapping(source = "product.id", target = "productId")
    @Mapping(source = "product.productName", target = "productProductName")
    StrichenDTO toDto(Strichen strichen); 

    @Mapping(source = "productId", target = "product")
    Strichen toEntity(StrichenDTO strichenDTO); 
    default Strichen fromId(Long id) {
        if (id == null) {
            return null;
        }
        Strichen strichen = new Strichen();
        strichen.setId(id);
        return strichen;
    }
}
